﻿Imports DotNetCore.BannerManagement.BLL

Partial Public Class ManageAdvertisements
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim advertiserManager As New BLL.AdvertiserManager

        Dim adManager As New BLL.AdvertisementManager

        gvAdvertisements.DataSource = adManager.GetAdvertisementByAdvertiserID(advertiserManager.GetAdvertiser(BLL.UserManager.GetInstance.GetUsername).ID)
        gvAdvertisements.DataBind()


        LoadProducts()
    End Sub

    Private Sub LoadProducts()

        Try
            Dim manager As New ProductManager
            gvProducts.DataSource = manager.GetAllProducts()
            gvProducts.DataBind()
        Catch ex As Exception

        End Try

    End Sub

    Private Sub gvProducts_SelectedIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSelectEventArgs) Handles gvProducts.SelectedIndexChanging
        Session.Add("ZoneId", gvProducts.DataKeys(e.NewSelectedIndex).Values(0)) ' Get zone name and store in session state

        Response.Redirect("AddProduct.aspx")
    End Sub

End Class